package com.zhuss.opus.processor;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.zhuss.bean.vo.opus.opus.DetailOpusAppendVo;
import com.zhuss.exception.ExceptionCode;
import com.zhuss.exception.WpsException;
import com.zhuss.opus.db.dao.ext.OpusAppendDao;


/**
 * 查询作品Append processor
 * @Author: zhushanshuo
 * @Date: 2019/9/24 19:54
 */
@Component("opusAppendRead")
public class OpusAppendRead {
	
	@Autowired
	private OpusAppendDao opusAppendDao;
	
	
	public List<DetailOpusAppendVo> listByType(Integer type, Long opusId, Long creatorId) {
		List<DetailOpusAppendVo> list = opusAppendDao.listByType(type, opusId, creatorId);
		return list;
	}
	
	public DetailOpusAppendVo getByType(Integer type, Long opusId, Long creatorId) {
		DetailOpusAppendVo result = opusAppendDao.getByType(type, opusId, creatorId);
		return result;
	}
	
	/**
	 * 作品Append详情
	 * @param opusAppendId
	 * @return
	 * @throws WpsException
	 */
	public Object detail(Long opusAppendId) throws WpsException {
		Object result = opusAppendDao.detail(opusAppendId);
		if (result == null) {
			throw new WpsException(ExceptionCode.数据不存在, "opusAppendId: " + String.valueOf(opusAppendId));
		}
		return result;
	}
	
	

}
